package br.com.friendzoone.conversores;

import javax.faces.component.UIComponent;
import javax.faces.context.FacesContext;
import javax.faces.convert.Converter;
import javax.faces.convert.FacesConverter;

import br.com.friendzoone.enums.EnumBase;

@FacesConverter("conversorEnum")  
public class ConversorEnum implements Converter {  
  
    @Override  
    public Object getAsObject(FacesContext context, UIComponent component, String value) {  
        
        return null;  
    }  
  
    @Override  
    public String getAsString(FacesContext context, UIComponent component, Object value) {  
        if (value != null && value instanceof EnumBase) {  
            return ((EnumBase) value).getValor().toString();  
        }  
        return null;  
    }  
  
} 